home *** CD-ROM | disk | FTP | other *** search
- Path: nntp-server.caltech.edu!news
- From: Xuhua Li <xuhua@cco.caltech.edu>
- Newsgroups: comp.lang.c++
- Subject: HELP about Visual C++
- Date: Mon, 18 Mar 1996 18:21:40 -0800
- Organization: California Institute of Technology, Pasadena
- Message-ID: <314E1A34.1935@cco.caltech.edu>
- NNTP-Posting-Host: xuhua-ppp.caltech.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=gb2312
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- When I try to simulate the EOF from the keyboard in Visual C++ with
- CTRL+Z from the command line, it doesn't work. CTRL+Z just kill
- the running program without flushing the output. I am running windows
- 95. I try many different key combinations, and none works as EOF. What
- is wrong with Visual C++, no way to simulate EOF from command line?
- Somebody said that it may be a bug in VC++. How can I get rid of this
- bug?
-
- BTW, are there any Visual C++ news groups or mailing lists? Is there
- free on-line C++ support? It seems Microsoft charges a lot for technical
- support. I am just a student learning VC++ and cannot afford their
- technical support subscrition for developers.
-
- I am very disappointed with Visual C++, it seems Borland is much much
- better, what do you think?
-
- Thank you very much for your help!
- Please try the following simple program from <<C++ Primer Plus>>:
-
- Program #1
- // textin3.cpp -- reading chars to end of file
- #include <iostream.h>
- int main(void)
- {
- char ch;
- int count = 0;
-
- while (cin.get(ch)) // cin.get(ch) is 0 on EOF
- {
- cout << ch;
- count++;
- }
- cout << count << " characters read\n";
- return 0;
- }
-
- The following is somebody's suggestion:
- When I do this with Viaul C++, hitting CTRL-Z does end the program
- without flushing the output. Even adding cout.flush() does not
- improve matters. However, if you add logic to end the loop for
- some other reason, such as encountering a 'q' key, it is fine,
- which leads me to believe that the DOS emulation in either VC++
- or Windows95 is closing cout when the EOF is encountered for cin.
-
- When this is compiled and run using Borland 4.5 it works
- (i.e., prints the count), so it sounds like a bug in the VC++
- cin/cout command-line emulation.
-